home *** CD-ROM | disk | FTP | other *** search
- **
- ** Testplayer.s
- **
- ** A sample player that visually reports DeliTracker's actions
- ** within external players.
- **
- ** Use the source as a skeleton model for your own players.
- ** Refer to the sample sources for additional information.
- **
- ** Once assembled, load this player into DeliTracker, and try
- ** playing the file 'testmodule'. It is only a textfile with
- ** the word "TEST" at the beginning. Notice now that
- ** DeliTracker's actions on the module are visible. This should
- ** aid you in your coding sequences.
- **
- ** Original source by Peter Kunath and Frank Riffel of Delirium.
- **
- ** English, comments, and general banter by Kevin Dackiw.
- **
- ** Have any problems/concerns/ideas? Feel free to contact the
- ** authors:
- **
- ** Frank Riffel
- ** Merkstr. 27
- ** 8129 Wessobrunn
- ** Germany
- **
- ** Or myself:
- **
- ** Kevin Dackiw
- ** sikorsky@bode.ee.ualberta.ca (preferred)
- ** kevind@ersys.edmonton.ab.ca
- **
-
- incdir "includes:"
- include "misc/DeliPlayer.i"
-
- _LVOOldOpenLibrary EQU -408 ; exec library offsets
- _LVOCloseLibrary EQU -414
-
- _LVOTextRequest EQU -174 ; offset for TextRequest in Req.
-
- ;
- ;
- SECTION Player,Code
- ;
- ;
- PLAYERHEADER PlayerTagArray ; define start of header
-
- dc.b '$VER: TestPlayer V1.15 (29 Jul 92)',0 ; for OS 2.0 version command
- even
-
- PlayerTagArray
- dc.l DTP_PlayerVersion,1 ; define all the tags
- dc.l DTP_PlayerName,PName ; for the player
- dc.l DTP_Creator,CName
- dc.l DTP_Check2,Chk ; omit any unused
- dc.l DTP_Config,Config ; functions as
- dc.l DTP_UserConfig,UserConfig ; needed!
- dc.l DTP_SubSongRange,SubSong
- dc.l DTP_InitPlayer,InitPlay
- dc.l DTP_EndPlayer,EndPlay
- dc.l DTP_InitSound,InitSnd
- dc.l DTP_EndSound,EndSnd
- dc.l DTP_StartInt,StartSnd
- dc.l DTP_StopInt,StopSnd
- dc.l DTP_Volume,Volume
- dc.l DTP_Balance,Balance
- dc.l DTP_Faster,Faster
- dc.l DTP_Slower,Slower
- dc.l DTP_PrevPatt,PrevPatt
- dc.l DTP_NextPatt,NextPatt
- dc.l DTP_PrevSong,PrevSub
- dc.l DTP_NextSong,NextSub
- dc.l TAG_DONE ; signify end of tags
-
- *-----------------------------------------------------------------------*
- ;
- ; Playername / creatorname and textstructure for our requesters
- ;
- *-----------------------------------------------------------------------*
-
- PName dc.b 'TestPlayer',0
- CName dc.b 'Written by Delirium for Testpurposes',0
- even
-
- reqname dc.b 'req.library',0
- even
-
- TextStruct
- dc.l 0 ; ^Text
- dc.l 0 ; ^ParamList
- dc.l 0 ; ^Window
- dc.l 0 ; ^MiddleText
- dc.l 0 ; ^PositiveText
- dc.l OKTxt ; ^NegativeText
- dc.l TitleTxt ; ^Title
- dc.w $ffff ; KeyMask
- dc.w 0 ; textcol
- dc.w 0 ; detailcol
- dc.w 0 ; blockcol
- dc.w 0 ; versionnumber
- dc.w 0 ; Timeout
- dc.l 0 ; abortmask
- dc.l 0 ; reserved
-
- OKTxt
- dc.b ' OK ',0
-
- TitleTxt
- dc.b 'Information',0
-
- InitTxt1
- dc.b 10
- dc.b 'InitPlayer routine called.',10,10
- dc.b 'This routine is called every time a new module is loaded.',10
- dc.b 'The audiochannels should be allocated here, and any',10
- dc.b 'player specific initialization should be performed.',10
- dc.b 0
-
- EndTxt1
- dc.b 10
- dc.b 'EndPlayer routine called.',10,10
- dc.b 'This routine is called every time a module is killed',10
- dc.b '(removed from memory). Player specific cleanup routines',10
- dc.b 'are performed here, and the audiochannels should be',10
- dc.b 'released at this point.',10
- dc.b 0
-
- InitTxt2
- dc.b 10
- dc.b 'InitSound routine called.',10,10
- dc.b 'This routine handles the initialization of the module.',10
- dc.b 0
-
- EndTxt2
- dc.b 10
- dc.b 'EndSound routine called.',10,10
- dc.b 'This routine clears the audioregisters.',10
- dc.b 0
-
- StartTxt
- dc.b 10
- dc.b 'StartSound routine called.',10,10
- dc.b 'This code must start the sound interrupts.',10
- dc.b 'If you use the internal DeliTracker routines, you must',10
- dc.b 'omit this entry from the TagArray.',10
- dc.b 0
-
- StopTxt
- dc.b 10
- dc.b 'StopSound routine called.',10,10
- dc.b 'This code must stop the sound interrupts.',10
- dc.b 'If you use the internal DeliTracker routines, you must',10
- dc.b 'omit this entry from the TagArray.',10
- dc.b 0
-
- InfoTxt1
- dc.b 10
- dc.b 'UserConfig routine called.',10,10
- dc.b 'This routine is for the use of advanced players.',10
- dc.b 'For example, if your player needs access to a directory',10
- dc.b 'of instruments, this routine could prompt the user with',10
- dc.b 'a requester for the path to the instruments. Additionally',10
- dc.b 'the path could then be saved in a custom config file, such',10
- dc.b 'as s:<playername>.config. Any future runs of the player',10
- dc.b 'would only then have to fetch the path from its config file.',10
- dc.b 'This custom config file must be accessed from the Config routine.',10
- dc.b 0
-
- InfoTxt2
- dc.b 10
- dc.b 'ConfigPlayer routine called.',10,10
- dc.b 'This routine is entered after the player is loaded.',10
- dc.b 'At this point you may load a custom config file to fetch',10
- dc.b 'such things as a default instrument path, and the like.',10
- dc.b 0
-
- InfoTxt3
- dc.b 10
- dc.b 'NextPattern routine called.',10,10
- dc.b 'This routine skips ahead one pattern in the module.',10
- dc.b 0
-
- InfoTxt4
- dc.b 10
- dc.b 'PrevPattern routine called.',10,10
- dc.b 'This routine skips back one pattern in the module.',10
- dc.b 0
-
- InfoTxt5
- dc.b 10
- dc.b 'NextSubsong routine called.',10,10
- dc.b 'This routine jumps to the next subsong (if supported).',10
- dc.b 0
-
- InfoTxt6
- dc.b 10
- dc.b 'PrevSubsong routine called.',10,10
- dc.b 'This routine jumps to the previous subsong (if supported).',10
- dc.b 0
-
- InfoTxt7
- dc.b 10
- dc.b 'PlayFaster routine called.',10,10
- dc.b 'This routine increases the playspeed.',10
- dc.b 0
-
- InfoTxt8
- dc.b 10
- dc.b 'PlaySlower routine called.',10,10
- dc.b 'This routine decreases the playspeed.',10
- dc.b 0
-
- InfoTxt9
- dc.b 10
- dc.b 'SubSong routine called.',10,10
- dc.b 'This routine must determine the min & max subsong number.',10
- dc.b 0
-
- InfoTxt10
- dc.b 10
- dc.b 'Volume routine called.',10,10
- dc.b 'This routine controls the volume.',10
- dc.b 0
-
- InfoTxt11
- dc.b 10
- dc.b 'Balance routine called.',10,10
- dc.b 'This routine controls the balance.',10
- dc.b 0
-
- even
-
- *-----------------------------------------------------------------------*
- ;
- ; Check if the module is a TestPlayer-Module (THIS ROUTINE MUST EXIST!!!)
- ;
- *-----------------------------------------------------------------------*
-
- Chk move.l dtg_ChkData(a5),a0 ; get module base from DT
- moveq #0,d0 ; clear register
- cmpi.l #'TEST',(a0) ; supported type ?
- sne d0 ; no - signal false
- rts ; leave
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Initialize the player
- ;
- *-----------------------------------------------------------------------*
-
- InitPlay
- lea InitTxt1(pc),a2 ; fetch text
- bsr DisplayMsg ; output
- moveq #0,d0 ; no error
- rts
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Clean up the player
- ;
- *-----------------------------------------------------------------------*
-
- EndPlay
- lea EndTxt1(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Initialize the module
- ;
- *-----------------------------------------------------------------------*
-
- InitSnd
- lea InitTxt2(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; End sound
- ;
- *-----------------------------------------------------------------------*
-
- EndSnd
- lea EndTxt2(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Start interrupts
- ;
- *-----------------------------------------------------------------------*
-
- StartSnd
- lea StartTxt(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Start interrupts
- ;
- *-----------------------------------------------------------------------*
-
- StopSnd
- lea StopTxt(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; IMPORTANT NOTE:
- ; There is a BIG difference between the »Config« and the
- ; »UserConfig« Routine !!! The Config routine is immediately
- ; called after that the Player is loaded. It is used to
- ; configure player (e.g. load config file and set pathes)!
- ; The UserConfig routine is only called if the User selects
- ; the player in the PrefWindow and presses the Config Player
- ; GADGET. This routine is thought as a method of getting
- ; informations (playerspecific preferences) from the user
- ; (e.g. pathes for instruments or maximum memory usage).
- ; The difference between Config and InitPlayer is that
- ; Config is called ONCE the player is loaded and that
- ; InitPlayer is called every time a module is played.
- ;
- *-----------------------------------------------------------------------*
- ;
- ; get/set playerspecific preferences (configuration routines)
- ;
- *-----------------------------------------------------------------------*
-
- UserConfig
- lea InfoTxt1(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
- Config
- lea InfoTxt2(pc),a2 ; fetch text
- bsr DisplayMsg ; output
- moveq #0,d0 ; no error
- rts
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Patterncontrol
- ;
- *-----------------------------------------------------------------------*
-
- NextPatt
- lea InfoTxt3(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
- PrevPatt
- lea InfoTxt4(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Subsongcontrol
- ;
- *-----------------------------------------------------------------------*
-
- SubSong
- lea InfoTxt9(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
- NextSub
- lea InfoTxt5(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
- PrevSub
- lea InfoTxt6(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Speedcontrol
- ;
- *-----------------------------------------------------------------------*
-
- Faster
- lea InfoTxt7(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
- Slower
- lea InfoTxt8(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Volume & Balance Control
- ;
- *-----------------------------------------------------------------------*
-
- Volume
- lea InfoTxt10(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
- Balance
- lea InfoTxt11(pc),a2 ; fetch text
- bra DisplayMsg ; output
-
-
- *-----------------------------------------------------------------------*
- ;
- ; Subroutines
- ;
- *-----------------------------------------------------------------------*
-
- DisplayMsg
- lea reqname(pc),a1
- move.l 4.w,a6
- jsr _LVOOldOpenLibrary(a6) ; open req.library
- tst.l d0
- beq.s DisplayEnd ; library open failed
-
- lea TextStruct(pc),a0 ; address of text structure
- move.l a2,(a0) ; copy text pointer to block
- move.l d0,a6 ; get ReqBase address
- jsr _LVOTextRequest(a6) ; print the message
-
- move.l a6,a1
- move.l 4.w,a6
- jsr _LVOCloseLibrary(a6) ; close req.library
- DisplayEnd
- rts ; bye!
-
- END
-